<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Admin</title>
<?php include("../3-includes/settings.php"); ?>
<?php
if ($_COOKIE['authd'] != "true") {
	header("Location: login.php");
}
if (isset($_GET['logout'])) {
	setcookie("authd","",time()-3600);
	header("Location: login.php");
}
?>
<script type="text/javascript" src="center.js"></script>
		</script>
<link rel="stylesheet" type="text/css" href="admin.css"/>
<style>
 .td {
	 width: 50%;
}
</style>
</head>

<body>
<div class="wrap" id="content">
<h2>Settings, <a href="?logout">Logout?</a></h2>
<table>
<form method="post">
<tr><td>Name</td><td><input type="text" value="<?php echo $name; ?>" name="name" id="name" /></td></tr>
<tr><td>Domain, remember, no "/" at the end</td><td><input type="text" value="<?php echo $domain; ?>" name="domain" id="domain" /></td></tr>
<tr><td>Theme</td><td>
<select name="theme">
	<option value="dark" <?php if($theme == "dark"){?>selected<?php } ?>>Dark</option> 
	<option value="white" <?php if($theme == "white"){?>selected<?php } ?>>White</option> 
</select>
</td></tr>
<tr><td>Submit</td><td><input type="submit" value="Go!" name="submit" /></td></tr>
</form>
<?php
if (isset($_GET['settings'])) {
	echo "<tr><td></td><td>Settings updated!</td></tr>";
}
if (isset($_POST['submit'])) {
	$name = $_POST['name'];
	$domain = $_POST['domain'];
	$theme = $_POST['theme'];
	$query = @mysql_query("UPDATE `$settingsTable` SET `name`='$name', `domain`='$domain', `theme`='$theme' WHERE `id`=1 LIMIT 1;") or die("Query error! Error Code: settings1");
	header("Location: ?settings");
	
}
?>
</table>
</div>
</body>
</html>